<?php
/**
 * User: Jerry
 * Date: 2017/6/2
 * Time: 14:32
 */

namespace SDXApi\Controller;


use SDXApi\Common\Tools\AppVersion;
use SDXApi\Model\ArticleModel;

/**
 * Class ArticleController
 * @author Jerry
 * @package SDXApi\Controller
 */
class ArticleController extends AppController
{
    /**
     * @author Jerry
     */
    public function getArticleList()
    {
        $articleModel = new ArticleModel();
        $article = $articleModel->findArticleByCatId(4);

        if (empty($article)) {
            returnApiError('暂无数据');
        }

        $version = AppVersion::getAppVersion();

        if ($version['app'] != 'h5') {
            foreach ($article as $key => $value) {
                $article[$key]['content'] = strip_tags($value['content']);
            }
        }

        $data['article_list'] = $article;
        $data['phone'] = '400-830-2108';

        returnApiSuccess($data);
    }
}